package cloud.demarcia.rabbitregister.controller;

import cloud.demarcia.rabbitregister.service.ForgetService;
import cloud.demarcia.rabbitregister.vo.UserForgetVo;
import cloud.demarcia.rabbitregister.vo.UserRegisterVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Bojun Wen, wen_bj@outlook.com
 * @date 2022.02.26
 */
@Slf4j
@CrossOrigin
@RestController
public class ForgetController {

    @Resource
    private ForgetService forgetService;

    @PostMapping("/confirm")
    public ResponseEntity<String> sendConfirmEmail(@RequestBody String email){
        log.info("忘记密码发送邮件：{}",email);
        forgetService.sendConfirmEmail(email);
        return ResponseEntity.ok().build();
    }
    @PostMapping("/forget")
    public ResponseEntity<String> forgetAccount(@RequestBody UserForgetVo vo){
        log.info("忘记密码:{}",vo);
        forgetService.forget(vo);
        return ResponseEntity.ok().build();
    }

}
